package com.we823.project.common.file;

import java.util.ArrayList;
import java.util.List;

import com.we823.project.model.product.PlanDetailModel;
import com.we823.utils.web.DateUtil;

public class TaskReportUtil extends ExcelUtil<PlanDetailModel> {

	@Override
	public List<String[]> parseContent(List<PlanDetailModel> content) {
		if(content!=null) {
			List<String[]> contentList = new ArrayList<>();
			int index=1;
			for (PlanDetailModel planDetailModel : content) {
				String[] planDetail = new String[] {
						index+"",
						planDetailModel.getPlanCode(),
						planDetailModel.getTaskCode(),
						planDetailModel.getMaterialModel(),
						planDetailModel.getMaterialDesc(),
						planDetailModel.getNeedTotal()+"",
						planDetailModel.getUnit(),
						planDetailModel.getStationName(),
						planDetailModel.getRealname(),
						DateUtil.parse(planDetailModel.getCreateDate(),"yyyy-MM-dd"),
						DateUtil.parse(planDetailModel.getFinishDate(),"yyyy-MM-dd"),
						planDetailModel.getCountTime(),
						planDetailModel.getStatus().getDisplay()
				};
				contentList.add(planDetail);
				index++;
			}
			return contentList;
		}
		return null;
	}

	@Override
	public String[] buildHeader() {
		return new String[] {
				"序号",
				"计划编号",
				"任务单",
				"规格型号",
				"颜色",
				"生产数量",
				"单位",
				"工位",
				"生产人员",
				"开始日期",
				"完成日期",
				"用时",
				"状态"
		};
	}

}
